import service from "@/request/wyyx";
interface searchModel {
categoryInfoList:[]
categoryL1List:[]
directActualQuery:[]
directOrginQuery:string
directlyList:[]
fromSearch:number
hasMore:boolean
matchType:number
searchEggActivityResultVO:Object
searchParams:Object
searchVersion:string
similarActualQuery:[]
similarCategoryInfoList:[]
similarList:[]
similarOrginQuery:string
similarSearchVersion:string
suggestTermList:[]
topics:[]
}
export interface hotSearchModel{
  colorfulEggList: []
defaultKeyword: null
defaultKeywords: []
hotKeywordVOList:[]
}

// 获取热门搜索
export const reqGetSearchHotKeyword = () => {
  return service.get<any,hotSearchModel>('xhr/search/init.json')
}
//获取实时搜索 https://m.you.163.com/xhr/search/searchAutoComplete.json
export const reqGetRealSearch = (realSearch:string) => {
  return service.post<any,string[]>('xhr/search/searchAutoComplete.json',realSearch)
}

// 根据关键字获取搜索详情
export const reqSearchInfo = (keyWord:string) => {
  return service.get<any,searchModel>(`xhr/search/search.json?__timestamp=1630133434953&needPopWindow=true&searchWordSource=7&stillSearch=false&_stat_search=autoComplete&itemId=0&size=40&upperPrice=-1&floorPrice=-1&matchType=0&categoryId=0&descSorted=false&sortType=0&keyword=${keyWord}`)
}
// 获取搜索详情分类
export const reqSearchCategory = (categoryId:number,keyword:string) => {
  return service.get<any,searchModel>(`xhr/search/search.json?__timestamp=1630133434953&needPopWindow=true&searchWordSource=7&stillSearch=false&_stat_search=autoComplete&itemId=0&size=40&upperPrice=-1&floorPrice=-1&matchType=0&categoryId=${categoryId}&descSorted=false&sortType=0&keyword=${keyword}`)
}
// 根据价格获取搜索详情
export const reqSearchPrice = (upperPrice:number,floorPrice:number,sortType:number,keyword:string) => {
  return service.get<any,searchModel>(`xhr/search/search.json?__timestamp=1630133434953&needPopWindow=false&searchWordSource=7&stillSearch=false&_stat_search=autoComplete&itemId=0&size=40&upperPrice=${upperPrice}&floorPrice=${floorPrice}&matchType=1&categoryId=0&descSorted=false&sortType=${sortType}&keyword=${keyword}`)
}